#include "ctpl.hpp"
#include <string>
#include <chrono>

int A(std::string str, int numb) {
    while (true) {
        std::cout << "A thread params: " << str + "  " << numb << std::endl;
        std::this_thread::sleep_for(std::chrono::seconds(1));
    }
    return 10;
}

void B() {
    std::this_thread::sleep_for(std::chrono::seconds(20));
    std::cout << "B thread no params" << std::endl;
}


int main() {
    ctpl::ctpl_thread_pool pool(2);
    pool.push(B);
    pool.push(A, "hello world", 666);

    auto C = [](std::string str) {
        std::this_thread::sleep_for(std::chrono::seconds(5));
        std::cout << "C thread params: " << str << std::endl;
        return 100;
    };
    auto r = pool.push(C, "CCCCCCCCCCCCCCCCCCc");
    std::cout << "C thread's return val = " + std::to_string(r.get()) << std::endl;

    std::this_thread::sleep_for(std::chrono::seconds(60));
}